sampler2D Tex0;




//float4 SpecifiedTones;
float4 min;
float4 max;
float4 overMax;
float4 underMin;
float4 ClearWhite = {1,1,1,1};
struct VertexShaderOutput
{
    float2 TexCoord0 : TEXCOORD0;
};

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
	float4 colour = 0;



	colour = tex2D(Tex0, input.TexCoord0);
	colour.rgb += smoothstep(min, min + max, colour.rgb);
	//colour.rgb += ClearWhite - smoothstep(min - max, min, colour.rgb);

	colour.a = 1.0f;

	return colour;
}

float4 PixelShaderFunctionOFL(VertexShaderOutput input) : COLOR0
{
	float4 colour = 0;


	colour = tex2D(Tex0, input.TexCoord0);

	colour.rgb = smoothstep(underMin, max, colour.rgb);
	colour.rgb = smoothstep(min, overMax, colour.rgb);

	colour.a = 1.0f;

	return colour;
}




technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }

	pass Pass2
	{
		 PixelShader = compile ps_2_0 PixelShaderFunctionOFL();
	}
}